Method for clustering samples with weakly supervised kernel mean shift matrices

ABSTRACT

A method clusters samples using a mean shift procedure. A kernel matrix is determined from the samples in a first dimension. A constraint matrix and a scaling matrix are determined from a constraint set. The kernel matrix is projected to a feature space having a second dimension using the constraint matrix, wherein the second dimension is higher than the first dimension. Then, the samples are clustered according to the kernel matrix.

FIELD OF THE INVENTION

This invention generally relates to mean shift clustering, and more particularly to weakly supervised kernel mean shift clustering of samples.

BACKGROUND OF THE INVENTION

Mean shift is an iterative procedure for locating stationary points of a density function derived from a set of samples. Although the mean shift procedure has been known for decades, it has only recently has been applied to computer vision applications, such as object tracking, image smoothing and foreground segmentation.

Mean shift clustering is an unsupervised density based nonparametric clustering technique for samples having an unknown distribution approximated by kernel density estimation. The cluster centers are located by the mean shift procedure, and the samples associated with the same local maxima of the density function cluster the samples. If label information is available, then the clustering accuracy can be improved significantly.

Weakly supervised clustering procedures can use pairwise “must-link” constraints to specify that two samples belong to the same cluster. Constraints of this form are natural in the context of graph partitioning, where edges in the graph encode pairwise relationships, such as in graph cuts and random walk segmentation.

Similarly, “cannot-link” constraints specify that two samples belong to different clusters. Hard constraints indicate that the constraints must be satisfied during clustering, whereas soft constraints are not necessarily satisfied but used as guide during clustering.

Unlike weakly supervised variants of k-means, spectral, and graph clustering methods, conventional mean shift methods do not utilize the label information to guide the clustering.

SUMMARY OF THE INVENTION

Mean shift clustering does not require prior knowledge of the number of clusters, and does not constrain a shape of the clusters. Instead, the clusters are based on an underlying probability distribution of samples, which is defined in advance using a distance metric. In many applications, the distance metric fails to resolve ambiguities in the clustering.

Embodiments of the invention provide a weakly supervised kernel mean shift procedure where the inherent structure of the samples is determined from constraints that specify pairs of samples that must be in the same cluster or different clusters.

The samples are implicitly projected to a higher dimension by a kernel function where the constraints can be effectively enforced during the clustering.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic a system and method for mean shift clustering according to embodiments of our inventions;

FIG. 2 is a graph of input samples according to embodiments of the invention;

FIG. 3 is a graph of the input samples projected to a feature space according to embodiments of the invention; and

FIG. 4 is a graph of the feature space projected to a null space of a similarity constraint vector according to embodiments of the invention;

FIG. 5 is a graph of input samples according to embodiments of the invention;

FIG. 6 is a graph of the input samples projected to a feature space according to embodiments of the invention;

FIG. 7 is a graph of the feature space projected to a space where soft similarity constraint samples project to nearby locations according to embodiments of the invention;

FIG. 8 is a graph of input samples according to embodiments of the invention;

FIG. 9 is a graph of the input samples projected to a feature space according to embodiments of the invention; and

FIG. 10 is a graph of the feature space projected to a space where dissimilarity constraint samples project to distant locations according to embodiments of the invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT Overview

FIG. 1 show a system and method 100 for mean shift clustering of samples according to embodiments of our inventions. The samples can be any data acquired by conventional means, e.g., by extracting features from images.

A kernel matrix K 111 is determined from samples 101 in a first dimension. A constraint matrix C and a scaling matrix S 121 are determined from a constraint set 102. The kernel matrix is projected 130 to a second dimension K′ of a feature space 131, wherein the second dimension is higher than the first dimension. Then, the samples are clustered 140 into clusters 141 using the matrix K′. Cluster centers 142 can also be determined. The above steps can be performed in a computer system including a memory and input/output interfaces as known in the art.

Example of Constrained Clustering

FIG. 2 shows samples, (+), and a constraint sample pair (x), (c₁, c₂). FIG. 3 shows the projecting to a higher dimensional feature space using a quadratic mapping function φ(x)=[x x ²]^(T), where T is the transpose operator. The arrow 301 is a constraint vector (φ(c₂)−φ(c₁))^(T), and the dotted line 302 indicates a null space. The null space of the matrix K is the set of all vectors x for which Kx=0.

FIG. 4 shows the projection of the feature space to the null space of the constraint vector. The constrained samples are in two clusters that can easily be identified.

Motivation

The invention is motivated by the idea to enforce the set of constraints so that a similar pair of samples are in the same cluster. In addition, we modify the clusters at a local scale and carry the enforced structure to the input samples. By doing so, it is possible to guide the clustering towards the interested structure of the samples using only a small number of constraints.

Our constrained mean shift clustering is based on projecting the samples to the higher dimension than the dimension of the sample space so that the constrained pairs are associated with the same mode when the density estimation is performed in the higher dimensional feature space. In addition, we preserve the original distances between the samples during the projecting while satisfying the constraints.

We begin with the example shown in FIGS. 2-4 with a single constraint and where the clusters are linearly separable. The sample pair (c₁, c₂) is constrained. If we project the samples to the null space 302 of (c₂−c₁)T, which is orthogonal to the constraint vector 301, then the samples c₁ and c₂ project to the same point, and it is guaranteed that the samples are associated with the same mode. In addition, the null space projection is the optimal linear projection because it preserves the variance along the orthogonal directions to the projection direction.

However, this approach does not scale well with an increasing number of constraints. Given m linearly independent constraint vectors on a d-dimensional input space, the null space of the constraint matrix is d−m dimensional. This implies that if more than d−1 constraints are specified, all samples are in a one cluster.

Our solution projects the samples to the higher dimensional feature space using a mapping function φ. Then, the same technique can used to project the samples to the null space of (φ(c₂)−φ(c₁))^(T).

FIG. 2 shows the (first) one-dimensional space of the samples, which appear to be in three clusters. We incorporate the label information in terms of the pairwise constraint enforcing the two samples c₂ and c₁ to be clustered together.

As shown in FIG. 3, samples are explicitly projected to the (second) two-dimensional feature space via the quadratic mapping function φ(x)=[x x²]^(T). This projection is an arbitrary example. As shown in FIG. 4, by projecting the input space to the null space of the constraint vector, the constrained samples points collapse to a single point, and the clustering groups the samples together.

In FIGS. 5-7, we show clustering with soft similarity constraints. For ease of illustration, only a single constraint is shown. However, the method is identical for multiple constraints.

In FIG. 5, the samples are in the original space. In FIG. 6, the samples are projected to the feature space with quadratic mapping. In clustering with soft similarity constraints, we scale the samples along the constraint vector direction 303, such that the constraint pair approaches each other.

FIG. 7 shows the scaling. With this scaling, the constraint samples are closer to each other in the feature space, and more likely to be clustered into the same cluster.

FIGS. 8-10 show clustering with dissimilarity constraints. For ease of illustration, only a single constraint is shown. However, the method is identical for multiple constraints.

In FIG. 8, samples are in the original space. In FIG. 9, the samples are projected to the feature space with quadratic mapping. In clustering with dissimilarity constraints, we scale the samples points along the constraint vector direction 305, such that the constraint pair becomes distant from each other. This scaling is shown in FIG. 10. Although there appears to be two clusters in the original space of FIG. 8, three clusters are clearly visible in FIG. 10, where two constraint points are put into different clusters.

However, the explicitly projection and working in the higher dimensional space is not practical. Therefore, we provide a kernel based mean shift procedure, which implicitly works on the higher dimensional feature space, and extends the conventional Euclidean mean shift to inner product spaces. Then, the constrained mean shift on the kernel induced space reduces to modifying the kernel matrix with respect to the defined constraints.

Mean Shift Clustering

Our mean shift procedure is an extension of U.S. Pat. No. 6,590,999, “Real-time tracking of non-rigid objects using mean shift,” issued to Comaniciu et al. on Jul. 8, 2003. Given n samples x_(i) in a d-dimensional space, and associated scale (bandwidth) h_(i)=h(x_(i)), i=1, . . . , n, a sample density estimator for a profile k(x) is

$\begin{matrix} {{f(x)} = {\frac{1}{n}{\sum\limits_{i = 1}^{n}\;{\frac{1}{h_{i}^{d}}{{k\left( {\frac{x - x_{i}}{h_{i}}}^{2} \right)}.}}}}} & (1) \end{matrix}$

We use a multivariate profile

$\begin{matrix} {{{k(x)} = {\mathbb{e}}^{{- \frac{1}{2}}x}}{x \geq 0.}} & (2) \end{matrix}$

By taking the gradient of Equation (1), the stationary points of the density function satisfy

$\begin{matrix} {{{\frac{2}{n}{\sum\limits_{i = 1}^{n}\;{\frac{1}{h_{i}^{d + 2}}\left( {x_{i} - x} \right){g\left( {\frac{x - x_{i}}{h_{i}}}^{2} \right)}}}} = 0},} & (3) \end{matrix}$ where g(x)=−k′(x). The solution can be determined iteratively via a fixed point mean shift procedure

$\begin{matrix} {{a.\mspace{14mu}\overset{\_}{x}} = {\frac{\sum\limits_{i = 1}^{n}\;{\frac{x_{i}}{h_{i}^{d + 2}}{g\left( {\frac{x - x_{i}}{h_{i}}}^{2} \right)}}}{\sum\limits_{i = 1}^{n}\;{\frac{1}{h_{i}^{d + 2}}{g\left( {\frac{x - x_{i}}{h_{i}}}^{2} \right)}}}.}} & (4) \end{matrix}$

Convergence to a local mode of the distribution is guaranteed when the mean shift iterations start at a sample.

Kernel Mean Shift

The kernel mean shift procedure forms the basis for our constrained mean shift procedure. We extend the conventional mean shift procedure from Euclidean spaces to inner product spaces. This makes it is possible to apply the procedure to a larger class of problems, such as the clustering samples that lie on arbitrary manifolds.

The set of input samples is x_(i) εX, i=1, . . . , n, not necessarily Euclidean. Let K: X×X be a positive definite kernel function satisfying, for all x, x,′ K(x,x′)=φ(x)^(T)φ(x′),  (5) where the mapping function φ projects the samples to the d_(φ)-dimensional feature space H, φ(x)=[φ₁(x)φ₂(x), . . . , φd _(φ)(x)]^(T).

The kernel makes it possible to implicitly project the samples to the higher dimensional feature space where the nonlinear structure of samples can be observed, and the constraints can be effectively applied.

We define the mean shift procedure on the feature space H in terms of an explicit representation of the mapping function φ. A sample density estimator at y ε H is

$\begin{matrix} {{f_{\mathcal{H}}(y)} = {\frac{1}{n}{\sum\limits_{i = 1}^{n}\;{\frac{1}{h_{i}^{d_{\phi}}}{{k\left( {\frac{y - {\phi\left( x_{i} \right)}}{h_{i}}}^{2} \right)}.}}}}} & (6) \end{matrix}$

Taking the gradient of Equation (6) with respect to φ, the stationary points of the density function satisfy

$\begin{matrix} {{\frac{2}{n}{\sum\limits_{i = 1}^{n}\;{\frac{1}{h_{i}^{d_{\phi} + 2}}\left( {{\phi\left( x_{i} \right)} - y} \right){g\left( {\frac{y - {\phi\left( x_{i} \right)}}{h_{i}}}^{2} \right)}}}} = 0.} & (7) \end{matrix}$

As for Equation (4), the solution can be found iteratively as

$\overset{\_}{y} = {\frac{\sum\limits_{i = 1}^{n}\;{\frac{\phi\left( x_{i} \right)}{h_{i}^{d_{\phi} + 2}}{g\left( {\frac{y - {\phi\left( x_{i} \right)}}{h_{i}}}^{2} \right)}}}{\sum\limits_{i = 1}^{n}\;{\frac{1}{h_{i}^{d_{\phi} + 2}}{g\left( {\frac{y - {\phi\left( x_{i} \right)}}{h_{i}}}^{2} \right)}}}.}$

Now, we derive the implicit form of the procedure. The dφ×n matrix of the feature points is Φ=[φ(x ₁)φ(x ₂) . . . φ(x _(n))],  (9) and the n=n kernel matrix is K=Φ^(T)Φ, i.e., the Gram matrix, which is a symmetric matrix of the inner products. At each iteration of the mean shift procedure in Equation (8), an estimate y lies in the column space of Φ. Any point on the subspace spanned by the columns of Φ can be written as y=Φαy,  (10) where αy is an n-dimensional weighting vector. The distance between y and y′ is

$\begin{matrix} \begin{matrix} {{{y - y^{\prime}}}^{2} = {{{\Phi\alpha}_{y} - {\Phi\alpha}_{y^{\prime}}}}^{2}} \\ {= {{\alpha_{y}^{T}\Phi^{T}{\Phi\alpha}_{y}} + {\alpha_{y^{\prime}}^{T}\Phi^{T}{\Phi\alpha}_{y^{\prime}}} - {2\alpha_{y}^{T}\Phi^{T}{\Phi\alpha}_{y^{\prime}}}}} \\ {= {{\alpha_{y}^{T}K\;\alpha_{y}} + {\alpha_{y^{\prime}}^{T}K\;\alpha_{y^{\prime}}} - {2\alpha_{y}^{T}K\;{\alpha_{y^{\prime}}.}}}} \end{matrix} & (11) \end{matrix}$

The distances can be expressed in terms of the inner product of the samples and the method iteratively updates the weighting vector α_(y). Let e_(i) denote the i^(th) canonical basis for

^(n). The kernel mean shift procedure then becomes

$\begin{matrix} {{\overset{\_}{\alpha}}_{y} = {\frac{\sum\limits_{i = 1}^{n}\;{\frac{e_{i}}{h_{i}^{d_{\phi} + 2}}{g\left( \frac{{\alpha_{y}^{T}K\;\alpha_{y}} + {e_{i}^{T}{Ke}_{i}} - {2\alpha_{y}^{T}{Ke}_{i}}}{h_{i}^{2}} \right)}}}{\sum\limits_{i = 1}^{n}\;{\frac{1}{h_{i}^{d_{\phi} + 2}}{g\left( \frac{{\alpha_{y}^{T}K\;\alpha_{y}} + {e_{i}^{T}{Ke}_{i}} - {2\alpha_{y}^{T}{Ke}_{i}}}{h_{i}^{2}} \right)}}}.}} & (12) \end{matrix}$

The clustering algorithm begins with the samples on the kernel space. Therefore, the initial weighing vectors are α_(yi)=e_(i). Samples converging to the same mode are clustered.

The rank of the kernel matrix K is smaller than n, and the columns of Φ form an overcomplete basis. Therefore, the modes can be identified within an equivalence relationship where two modes are considered same when the distance on the feature space is zero. In addition, it is possible that the mode can not be represented on the input space X because the mapping function φ is not necessarily invertible.

Constrained Mean Shift Clustering Procedure

The set of m constrained samples is {(c_(j,1), c_(j,2))}. Initially, we project the samples to the feature space via the mapping function φ, and the constraints are satisfied by projecting the feature space to the null space of the constraint vectors. Let A be the m×d_(φ) dimensional constraint matrix

$\begin{matrix} {A = {\begin{pmatrix} \left( {{\phi\left( c_{1,1} \right)} - {\phi\left( c_{1,2} \right)}} \right)^{T} \\ \vdots \\ \left( {{\phi\left( c_{m,1} \right)} - {\phi\left( c_{m,2} \right)}} \right)^{T} \end{pmatrix}.}} & (13) \end{matrix}$

Given the samples and the constraint set, the constrained mean shift procedure projects the samples to the null space of the constraint matrix φ(x)=Pφ(x)  (14) where P is the projection matrix P=L _(dφ) −A ^(T)(AA ^(T))⁺ A,  (15) and implicitly perform the mean shift on the feature space. Because the constrained samples project to the same feature point, the samples converge to the same mode. Instead of rewriting the mean shift procedure on the feature space, it suffices to modify the kernel matrix K with respect to the projection, and apply the derived kernel mean shift procedure on the modified kernel matrix. The equivalence follows from the fact that apart from the distance computations, the procedure is identical and the distances only involve feature points in terms of the inner products. The projected kernel matrix is given by K(x,x′)−K(φ(x), A)^(T) S ⁺ K(φ(x′), A),  (16) where

$\begin{matrix} {S_{i,j} = {{K\left( {c_{i,1},c_{j,1}} \right)} - {K\left( {c_{i,1},c_{j,2}} \right)} - {K\left( {c_{i,2},c_{j,1}} \right)} + {K\left( {c_{i,2},c_{j,2}} \right)}}} & (17) \end{matrix}$ is the scaling matrix.

Instead of samples, it is sufficient to supply only the kernel matrix K 110 and the constraints 121 to our weakly supervised kernel mean shift procedure.

To reduce memory requirements, the kernel matrix K can be approximated by a low rank decomposition of the kernel matrix using an incremental singular value decomposition (SVD).

The “cannot-link” constraints can be applied in the same framework. The samples are scaled along the constraint vector directions such that the constraint pair becomes distant from each other. First, the samples are projected to the null space of the constraint vector according to Equation (14). Then, a scalar multiple of the constraint directions are added to the samples.

Let

$\begin{matrix} {A = \begin{pmatrix} \left( {{\phi\left( c_{1,1} \right)} - {\phi\left( c_{1,2} \right)}} \right)^{T} \\ \vdots \\ \left( {{\phi\left( c_{m,1} \right)} - {\phi\left( c_{m,2} \right)}} \right)^{T} \end{pmatrix}} & (18) \end{matrix}$ be the normalized constraint vectors. The scaling along each constraint direction is defined by

$\begin{matrix} {{s\left( {\phi(x)} \right)} = \begin{pmatrix} {\lambda_{1}\frac{\left( {{\phi\left( c_{1,1} \right)} - {\phi\left( c_{1,2} \right)}} \right)^{T}}{{{\phi\left( c_{1,1} \right)} - {\phi\left( c_{1,2} \right)}}}\left( {{\phi(x)} - {\phi\left( c_{1,2} \right)}} \right)} \\ \vdots \\ {\lambda_{m}\frac{\left( {{\phi\left( c_{m,1} \right)} - {\phi\left( c_{m,2} \right)}} \right)^{T}}{{{\phi\left( c_{m,1} \right)} - {\phi\left( c_{m,2} \right)}}}\left( {{\phi(x)} - {\phi\left( c_{m,2} \right)}} \right)} \end{pmatrix}} & (19) \end{matrix}$ where λ₁, . . . , λ_(m) control how much scaling is performed along each direction. The scaled projections are {circumflex over (φ)}(x)=Pφ(x)+s(φ(x))^(T) Ā.  (20)

Setting λ_(i) greater than 1 in Equation (19) scales the samples such that the constraint samples become distant from each other. By setting λ_(i) to larger values and using the kernel mean shift procedure, the constraint samples are grouped into different clusters, as shown in FIGS. 8-10.

The soft constraints can also be applied in the same framework. The samples are scaled along the constraint vector directions such that the constraint pair becomes closer to each other. This is achieved by setting λ_(i) less than 1 in Equation (19). The constraint samples are projected to nearby points, not necessarily to the same point. Hence, the constrained samples are used as a guide, but not necessarily grouped into the same cluster as shown in FIGS. 5-7. Setting λ_(i) equal to 0 is equivalent to the hard constraint algorithm described above.

The method extends the mean shift clustering to any inner product space and any arbitrary distance function satisfying a metric axioms.

Although the invention has been described by way of examples of preferred embodiments, it is to be understood that various other adaptations and modifications may be made within the spirit and scope of the invention. Therefore, it is the object of the appended claims to cover all such variations and modifications as come within the true spirit and scope of the invention. 

1. A method for clustering samples using a mean shift procedure, comprising the a computer system for performing steps of the method, comprising the steps of: determining a kernel matrix from the samples in a first one-dimensional space; determining a constraint matrix and a scaling matrix from a constraint set; projecting the kernel matrix to a two-dimensional feature space using the constraint matrix; clustering the samples using the mean shift procedure and soft similarity constraints according to the kernel matrix.
 2. The method of claim 1, further comprising: determining a center of each cluster.
 3. The method of claim 1, wherein the constraint set specifies pairs of samples to be clustered into the same cluster.
 4. The method of claim 1, wherein the constraint set specifies pairs of samples to be clustered into different clusters.
 5. The method of claim 1, wherein the projecting is explicitly defined with a mapping function φ of the samples.
 6. The method of claim 1, wherein the kernel function is a symmetric matrix of inner products and the projecting is implicit.
 7. The method of claim 1, wherein the projecting is orthogonal to the constraint vectors in the feature space.
 8. The method of claim 1, wherein the projecting scales the samples along the constraint vectors in the feature space.
 9. The method of claim 1, wherein the projecting preserves distances between the samples while satisfying the constraint set.
 10. The method of 1, wherein the samples lie on arbitrary manifolds.
 11. The method of claim 1, wherein the kernel matrix approximated by a low rank decomposition of the kernel matrix.
 12. The method of claim 1, wherein the projecting operates directly on the kernel matrix according to the constraint matrix.
 13. The method of claim 1, wherein the clustering uses an arbitrary distance metric.
 14. The method of claim 1, wherein the clustering uses soft dissimilarity constraints. 